package ua.com.softway.db.batch;

import java.util.List;

import org.hibernate.Criteria;

public interface BatchJob<T> {
    /**
     * Get size of the batch (step of batch query) 
     * @return
     */
    int getBatchSize();
    
    /**
     * Create criteria to be used in batch retreiving
     * Criteria will be later modified by one of batching strategies
     * 
     * @return
     */
    Criteria createCriteria();
    
    /**
     * Process batch step on items
     */
    void processBatch(List<T> list);
    
    /**
     * Called when job completed
     * Transaction is started
     */
    void completed();

    void failed();
}
